//
//  XWInterestCell.m
//  CGWSWW
//
//  Created by lanou3g on 16/8/16.
//  Copyright © 2016年 CXG. All rights reserved.
//

#import "XWInterestCell.h"
#import "XWInterestModel.h"
#import <UIImageView+WebCache.h>


@implementation XWInterestCell


//Model 属性 的 setter 方法
-(void)setModel:(XWInterestModel *)model
{
    if (_model != model) {
        _model = nil;
        _model = model;
    }

    [_headerImageView sd_setImageWithURL:[NSURL URLWithString:model.profile_image]];
    
    _nameLabel.text = model.name;
    _timeLabel.text = model.created_at;
    _textContextLabel.text = model.text;

    
    [_cellDingButton setTitle:[NSString stringWithFormat:@"%ld",model.ding] forState:(UIControlStateNormal)];
    
     [_cellCaiButton setTitle:[NSString stringWithFormat:@"%ld",model.cai] forState:(UIControlStateNormal)];
    
     [_cellShareButton setTitle:[NSString stringWithFormat:@"%ld",model.repost] forState:(UIControlStateNormal)];
    
     [_cellCommendButton setTitle:[NSString stringWithFormat:@"%ld",model.comment] forState:(UIControlStateNormal)];


}


// 计算高度
+(CGFloat)calsLabelHeightWithTextComment:(NSString *)textComment{
    
    // 1 文本内容高度
    CGRect rect = [textComment boundingRectWithSize:CGSizeMake(280, 2000) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15.0f]} context:nil];
    
    // 2 最热评论高度
    
    
    return rect.size.height;
}













// cell 分割效果
-(void)setFrame:(CGRect)frame
{
    frame.size.height -= 10;
    [super setFrame:frame];
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}



@end
